package com.paradise.ytj.view;

import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.StateListDrawable;
import android.util.AttributeSet;
import android.util.Log;
import android.view.View;
import android.view.ViewGroup;
import android.widget.CheckBox;
import android.widget.TextView;

import com.paradise.ytj.R;


/**
 * Created by Administrator on 2017/8/15 0015.
 */

public class ChoiceItem extends ItemSelectContainer {

    private TextView tvTitle;
    private TextView tvContent;
    private String titleText;
    private String contentText;

    public ChoiceItem(Context context) {
        this(context, null);
    }

    public ChoiceItem(Context context, AttributeSet attrs) {
        this(context, attrs, 0);
    }

    public ChoiceItem(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
        TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.ChoiceItem);
        titleText = typedArray.getString(R.styleable.ChoiceItem_titleText);
        contentText = typedArray.getString(R.styleable.ChoiceItem_contentText);
        initViw();
        typedArray.recycle();
    }

    private void initViw() {
        View inflate = View.inflate(getContext(), R.layout.item_choice, this);
        tvTitle = (TextView) inflate.findViewById(R.id.tv_title);
        tvContent = (TextView) inflate.findViewById(R.id.tv_content);
        tvTitle.setText(titleText);
        tvContent.setText(contentText);

    }

    public void setContentText(String content) {
        tvContent.setText(content);
    }

    public void setContentText(int id) {
        tvContent.setText(id);
    }

    @Override
    protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
        super.onMeasure(widthMeasureSpec, heightMeasureSpec);
    }
}
